#!/bin/bash
OK=0
WARN=1
CRITICAL=2
UNKNOWN=3
PATH="/bin:/sbin:/usr/bin:/usr/sbin"

Ok_name=''
Fail_name=''
Judge=0
TTimeout=2

function out_memory() {
		#continue
		memoryvalue=`/usr/bin/free | grep 'buffers/cache:'| awk '{print $3}'`
		memorylevel=41943040

                if [ $memoryvalue -gt $memorylevel ]
                then
                        Judge=1
                        Fail_name="Mem useage more than 40G"
		else
			Ok_name="Mem useage normal"
                fi
		#echo $choice end
}


out_memory 

if [ $Judge -eq 1 ]
then
	echo "$Fail_name  wrong"
	exit $CRITICAL
else
	echo " $Ok_name are OK "
	exit $OK
fi

else
	echo "can not find file /etc/init.d/eosd"
	exit $CRITICAL
fi
